package com.axjy.web;

import com.axjy.pojo.House;
import com.axjy.service.HouseService;
import com.axjy.vo.HouseDto;
import com.axjy.vo.PageVo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

@Controller
public class IndexController {

    @Resource
    private HouseService houseService;

    @GetMapping("/index")
    public String index(@RequestParam(value = "pager.offset",defaultValue = "0") Integer offset, @RequestParam(defaultValue = "5") Integer pageSize, HouseDto dto, Model model){
        PageVo vo=houseService.searchHouseByDto(offset,pageSize,dto);
        model.addAttribute("pager",vo);
        return "list";
    }

}
